<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        let status = 1;
        let userLogin = (resolve, reject) => {
            setTimeout(() =>{
               if(status == 1) {
                   resolve({data: 'xxxx', code: 1001, msg: '登录成功'})
               }else{
                   reject('登录失败')
               }
            }, 2000)
        }
        let getUserInfo = (resolve, reject) => {
            setTimeout(() => {
               resolve({data: 'xxxx', code: 1001, msg: '获取用户信息成功'})
            },1000)
        }
        new Promise(userLogin).then(res => {
            console.log(res);
            return new Promise(getUserInfo)
        }).then(res => {
            console.log(res);
        })
    </script>
</head>
<body>
    
</body>
</html>